import request from "@/utils/request";
import { PRODUCE, FORM, AUXILIARY } from "@/config/baseUrl.js";

// 查询详情
export function getHandoverDetail(groupProduceLogId) {
  return request({
    url: `${PRODUCE}/handover/groupProduceLog/getHandoverInfo`,
    method: "get",
    params: {
      groupProduceLogId,
    },
  });
}

// 保存交班详情
export function saveHandover(data) {
  return request({
    url: `${PRODUCE}/handover/groupProduceLog/saveHandoverInfo`,
    method: "post",
    data,
  });
}

// 确认交班
export function confirmHandover(data) {
  return request({
    url: `${PRODUCE}/handover/groupProduceLog/confirmHandover`,
    method: "post",
    data,
  });
}

// 刷新交接班工单物料数据接口
export function refershGroupOrderQtys(data) {
  return request({
    url: `${PRODUCE}/handover/groupProduceLog/refershGroupOrderQtys`,
    method: "post",
    data,
  });
}

// 查询班组生产记录对应任务统计信息
export function getTaskStatistics(params) {
  return request({
    url: `${PRODUCE}/handover/groupProduceLog/selectMissionStatistics`,
    method: "get",
    params,
  });
}

// 查询班组生产记录对应异常统计信息
export function getAbnormalStatistic(params) {
  return request({
    url: `${PRODUCE}/handover/groupProduceLog/selectAbnormalStatistics`,
    method: "get",
    params,
  });
}

// 查询班组生产记录对应异常统计信息
export function getWorkLogVoByProduceLogId(produceLogId) {
  return request({
    url: `${PRODUCE}/handover/groupProduceLog/getWorkLogVoByProduceLogId`,
    method: "get",
    params: { produceLogId },
  });
}

// 查询班组生产记录对应异常统计信息
export function getEquipOffLogByProduceLogId(params) {
  return request({
    url: `${PRODUCE}/handover/groupProduceLog/listEquipOffLogByProduceLogId`,
    method: "get",
    params,
  });
}

// 根据工单的实际开始/结束时间查询实际产量
export function getActualQtyByOrderIdAndTime(params) {
  return request({
    url: `${PRODUCE}/handover/order/getActualQtyByOrderIdAndTime`,
    method: "get",
    params,
  });
}

// 查询班组生产记录对应任务处理情况（任务列表）
export function getTaskList(data) {
  return request({
    url: `${FORM}/task/missionCenter/singleList`,
    method: "post",
    data,
  });
}

// 查询班组生产记录对应异常处理情况（异常列表）
export function getAbnormalListByLineCode(data) {
  return request({
    url: `${AUXILIARY}/abnormal/order/by/line/code`,
    method: "post",
    data,
  });
}

// 根据异常id查询列表（异常列表）
export function getAbnormalListByIds(data) {
  return request({
    url: `${AUXILIARY}/abnormal/order/by/ids`,
    method: "post",
    data,
  });
}


